package com.hdax.dm.controller;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hdax.dm.common.vo.order.OrderInfoVo;
import com.hdax.dm.dto.CommonResponse;
import com.hdax.dm.dto.DtoUtil;
import com.hdax.dm.entity.order.DmOrder;
import com.hdax.dm.feign.order.DmOrderFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping(path = "/pay")
public class DmOrderPayController {

    @Autowired
    private DmOrderFeign orderFeign;

    @RequestMapping("/permission/confirmpay")
    public CommonResponse<Map<String,Object>> confirmpay(@RequestBody Map<String,String> params){
        //根据orderNo查询到订单信息并返回
        DmOrder dmOrder = orderFeign.findOrder(params.get("orderNo"));
        Map<String,Object> map = new HashMap<>();
        map.put("itemName",dmOrder.getItemName());
        map.put("orderNo",dmOrder.getOrderNo());
        map.put("totalAmount",dmOrder.getTotalAmount());
        return DtoUtil.returnSuccess(map);
    }
}
